<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="root">
        <!-- 3.组件应用 -->
        <app></app>
        <hr>

    </div>

    <script src="../js/vue.js"></script>
    <script>
        Vue.config.productionTip = false //阻止 vue 在启动时生成生产提示。

        //1.定义student组件
        const student = Vue.extend({
            template:`
            <div>
                <h2>学校名称:{{studentName}}</h2>
                <h2>学校地址:{{age}}</h2>
            </div>
            `,
            data() {
                return {
                    studentName:'jiangwei',
                    age:18
                }
            },
        })
        //1.定义hello组件
        const hello = Vue.extend({
            template:`<h1>{{mgs}}</h1>`,
            data() {
                return {
                    mgs:"欢迎来到河南"
                }
            },
        })

        //1.定义school组件
        const school = Vue.extend({
            template:`
            <div>
                <hello></hello>
                <h2>学校名称:{{schoolName}}</h2>
                <h2>学校地址:{{address}}</h2>
                <student></student>
            </div>
            `,
            data() {
                return {
                    schoolName:'华北水利水电大学',
                    address:'郑州'
                }
            },
            //注册组件(局部)
            components:{
                student:student,
                hello:hello
            }
        })

        //定义app组件
        const app = Vue.extend({
            template:`
            <div>
                <hello></hello>
                <school></school>
            </div>
            `,
            components:{
                school:school,
                hello:hello
            }
        })
        new Vue({
            el:'#root',
            //2.注册组件(局部)
            components:{
                app:app,
            }
        })
    </script>
</body>
</html>